package common;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

public class History implements Serializable {
	
	/**
     * 
     */
    private static final long serialVersionUID = -2011834400999249652L;
    private List<historyEntry> history;
	
	public History() {
		history = new ArrayList<historyEntry>();
	}

	public void addEntry(Date date, List<String> rivals, int score) {
		history.add(new historyEntry(date,rivals,score));
	}
	
	public void addEntry(historyEntry entry) {
		history.add(entry);
	}
	
	public historyEntry getEntry(int index) {
		if ((index >= 0) && (index < history.size()))
			return history.get(index);
		return null;
	}
	
	public int getNumOfHistories() {
		return history.size();
	}
	
	public class historyEntry implements Serializable {
		
		/**
         * 
         */
        private static final long serialVersionUID = 7624125690072475068L;
        Date date;
		List<String> rivals;
		int score;
		
		public historyEntry(Date date, List<String> rivals, int score) {
			this.date = date;
			this.rivals = rivals;
			this.score = score;
		}

		public Date getDate() {
			return date;
		}

		public List<String> getRivals() {
			return rivals;
		}

		public int getScore() {
			return score;
		}
	}
}